import { createSelector } from 'reselect'
import * as utils from '@/utils/index.js'

const getCurrentPath = (state) => state.currentPath
const getNodeTree = (state) => state.nodeTree

export const getCurrentNode = createSelector(
  [getCurrentPath, getNodeTree],
  (path, nodeTree) => {
    let node = utils.getNodeByPath(nodeTree, path)
    return node?node:nodeTree[0]
  }
)